import unittest

from framework.AW.STrak import strak
from framework.AW.STrak.process import *
from framework.AW.STrak.strak import *
from framework.AW.STrak.station import *
from framework.AW.STrak.car import *


def process_shield():
    try:
        """
        用例1 工序屏蔽:
        仿真打开，初始化3辆小车，间距300mm
        配置：上海S3样机（环线）/S3样机配置（3个小车）
        1.重新启动 包含以下动作 ： 急停初始化复位(使能)启动
        2.屏蔽工序1，小车运行后停在工位2处 拥堵小车数为小车数-1
        3.取消屏蔽工序1，小车正常运行 拥堵小车数为0
        """

        restart()
        Process_Shield(1)
        assert jam_car_count() == car_num() - 1, "[工序屏蔽相关错误: 拥堵小车数量不正确]"
        Process_UnShield(1)
        assert jam_car_count() == 0, "[工序屏蔽相关错误: 拥堵小车数量不正确]"
    except Exception as e:
        print(f"测试过程出现异常:{e}")
        raise


class ProcessShield(unittest.TestCase):
    @staticmethod
    def testOn():
        process_shield()
